package com.cloudlead.forwardAction.action;

import com.cloudlead.common.lang.annotation.Label;
import com.cloudlead.common.lang.persistence.EasyuiGridData;
import com.cloudlead.common.worker.action.impl.AbstractActionFactory;
import com.cloudlead.common.worker.annotation.Action;
import com.cloudlead.common.worker.annotation.Order;
import com.cloudlead.forwardAction.BusinessModules;
import com.cloudlead.forwardAction.service.BaseShipRoutePriceEditSer;
import com.cloudlead.forwardService.BaseShipRoutePriceEditService;
import com.cloudlead.forwardService.vo.BaseShipRoutePriceCreateVo;
import com.cloudlead.forwardService.vo.BaseShipRoutePriceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.validation.constraints.NotNull;

/**
 * Created by wyj on 2015/8/19.
 */
@Controller
public class BaseShipRoutePriceEditActionFactory extends AbstractActionFactory implements BaseShipRoutePriceEditService {
    public BaseShipRoutePriceEditActionFactory() {
        super(BusinessModules.BaseShipRoutePriceEdit);
    }

    @Autowired
    BaseShipRoutePriceEditSer baseShipRoutePriceEditSer;

    @Override
    @Action
    @Order(1)
    @Label("航线报价创建")
    public String createBaseShipRoutePrice(@NotNull @Label("基础信息")BaseShipRoutePriceCreateVo cvo) {
        return baseShipRoutePriceEditSer.createBaseShipRoutePrice(cvo);
    }

    @Override
    @Action
    @Order(2)
    @Label("航线报价分页查询")
    public EasyuiGridData findAllBaseShipRoutePrice(@Label("基础数据")BaseShipRoutePriceVo vo, @Label("每页条数")int size, @Label("页码")int page) {
        return new EasyuiGridData(baseShipRoutePriceEditSer.findAllBaseShipRoutePrice(vo, size, page),"id,expiresEnd,baseShipRoute.startPort startPort" +
                ",baseShipRoute.destPort destPort,gp20,gp40,hc40,tk40,baseShipRoute.status status,baseShipRoute.baseShipRouteName baseShipRouteName," +
                "baseShipRoute.id baseShipRoute,expiresStart");
    }

    @Override
    @Action
    @Order(3)
    @Label("航线报价删除")
    public String delBaseShipRoutePrice(@NotNull @Label("航线报价ID")String id) {
        return baseShipRoutePriceEditSer.delBaseShipRoutePrice(id);
    }

    @Override
    @Action
    @Order(4)
    @Label("航线报价编辑")
    public void editBaseShipRoutePrice(BaseShipRoutePriceCreateVo vo) {
        baseShipRoutePriceEditSer.editBaseShipRoutePrice(vo);
    }
}
